home *** CD-ROM | disk | FTP | other *** search
- // ********************************************************************************************************************
- // Search Functions
- // ********************************************************************************************************************
-
- var globalHightLightColor = "";
- var globalHightLightColorCell1 = '';
- var globalHightLightColorCell2 = '';
- var globalHightLightColorCell3 = '';
-
- function issueItem() {
- var year;
- var nos = new Array();
- }
-
- function nodeResultItem() {
- var year = '';
- var nr = '';
- var category = '';
- var title = '';
- var description = '';
- var link = '';
- }
-
- var smallLetters = 'abcdefghijklmnopqrstuvwxyz';
- var bigLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- var xmlDocLocal = null;
- var xmlDocGlobal = null;
- var availableCategories = new Array();
- var availableIssues = new Array();
- var sorting = 1;
- var globalResultNodes = null;
- var localResultNodes = null;
-
- function sortByTitleDESC (a, b) {
- var valueA = a.title.toLowerCase();
- var valueB = b.title.toLowerCase();
- return ((valueA < valueB) ? -1 : ((valueA > valueB) ? 1 : 0));
- }
-
- function sortByTitleASC (a, b) {
- var valueA = a.title.toLowerCase();
- var valueB = b.title.toLowerCase();
- return ((valueA < valueB) ? 1 : ((valueA > valueB) ? -1 : 0));
- }
-
- function sortByCategoryDESC (a, b) {
- var valueA = a.category.toLowerCase();
- var valueB = b.category.toLowerCase();
- return ((valueA < valueB) ? -1 : ((valueA > valueB) ? 1 : 0));
- }
-
- function sortByCategoryASC (a, b) {
- var valueA = a.category.toLowerCase();
- var valueB = b.category.toLowerCase();
- return ((valueA < valueB) ? 1 : ((valueA > valueB) ? -1 : 0));
- }
-
- function sortByDescriptionDESC (a, b) {
- var valueA = a.description.toLowerCase();
- var valueB = b.description.toLowerCase();
- return ((valueA < valueB) ? -1 : ((valueA > valueB) ? 1 : 0));
- }
-
- function sortByDescriptionASC (a, b) {
- var valueA = a.description.toLowerCase();
- var valueB = b.description.toLowerCase();
- return ((valueA < valueB) ? 1 : ((valueA > valueB) ? -1 : 0));
- }
-
- function sortByIssueDESC (a, b) {
- var yearA = parseInt(a.year);
- var yearB = parseInt(b.year);
- var nrA = parseInt(a.nr);
- var nrB = parseInt(b.nr);
- if (yearA == yearB) {
- return ((nrA > nrB) ? 1 : ((nrA < nrB) ? -1 : 0));
- }
- else {
- return ((yearA > yearB) ? 1 : ((yearA < yearB) ? -1 : 0));
- }
- }
-
- function sortByIssueASC (a, b) {
- var yearA = parseInt(a.year);
- var yearB = parseInt(b.year);
- var nrA = parseInt(a.nr);
- var nrB = parseInt(b.nr);
- if (yearA == yearB) {
- return ((nrA < nrB) ? 1 : ((nrA > nrB) ? -1 : 0));
- }
- else {
- return ((yearA < yearB) ? 1 : ((yearA > yearB) ? -1 : 0));
- }
- }
-
- function doSort(nodesArray) {
- switch (sorting) {
- case 1:
- nodesArray.sort(sortByTitleDESC);
- break;
- case 2:
- nodesArray.sort(sortByTitleASC);
- break;
- case 3:
- nodesArray.sort(sortByCategoryDESC);
- break;
- case 4:
- nodesArray.sort(sortByCategoryASC);
- break;
- case 5:
- nodesArray.sort(sortByDescriptionDESC);
- break;
- case 6:
- nodesArray.sort(sortByDescriptionASC);
- break;
- case 7:
- nodesArray.sort(sortByIssueDESC);
- break;
- case 8:
- nodesArray.sort(sortByIssueASC);
- break;
- }
- }
-
- function setSorting(value, type) {
- if (sorting == value) {
- sorting = value+1;
- }
- else {
- if (sorting == value+1) {
- sorting = value;
- }
- else {
- sorting = value;
- }
- }
-
- if (type == 1) {
- doSort(localResultNodes);
- var html = getResultHTML(localResultNodes, 1);
- var searchContent = document.getElementById('searchContentLocal');
- if (searchContent != null) {
- searchContent.innerHTML = html;
- resizeIFrame();
- redrawResultsTable();
- }
- }
- else {
- doSort(globalResultNodes);
- var html = getResultHTML(globalResultNodes, type);
- var searchContent = document.getElementById('searchContentGlobal');
- if (searchContent != null) {
- searchContent.innerHTML = html;
- resizeIFrame();
- redrawResultsTable();
- }
- }
- }
-
- function existsInResults(arrResults, node) {
- var rN = null;
- for (var i=0; i<arrResults.length; i++) {
- rN = arrResults[i];
- if (rN.year == node.year && rN.nr == node.nr && rN.category == node.category && rN.title == node.title && rN.description == node.description && rN.link == node.link) {
- return true;
- }
- }
- return false;
- }
-
- function getResultArray(resultNodes) {
- var issueNode, resultNode;
- var result = new Array();
-
- for (var i=0; i<resultNodes.length; i++) {
- resultNode = resultNodes[i];
-
- if (resultNode.nodeName != 's') {
- resultNode = resultNode.parentNode;
- }
- issueNode = resultNode.parentNode;
- var itemNode = new nodeResultItem();
- itemNode.year = issueNode.getAttribute('year');
- itemNode.nr = issueNode.getAttribute('nr');
- itemNode.category = resultNode.getAttribute('c');
- if (resultNode.getElementsByTagName('t')[0].hasChildNodes) {
- itemNode.title = resultNode.getElementsByTagName('t')[0].firstChild.nodeValue;
- }
- else {
- itemNode.title = '';
- }
- if (resultNode.getElementsByTagName('k')[0].hasChildNodes) {
- itemNode.description = resultNode.getElementsByTagName('k')[0].firstChild.nodeValue;
- }
- else {
- itemNode.description = '';
- }
- if (resultNode.getElementsByTagName('a')[0].hasChildNodes) {
- itemNode.link = resultNode.getElementsByTagName('a')[0].firstChild.nodeValue;
- }
- else {
- itemNode.link = '';
- }
- if (!existsInResults(result, itemNode)) {
- result.push(itemNode);
- }
- }
- return result;
- }
-
- function getResultHTML(resultItems, type) {
- var resultNode, issueNode, category, title, description, link, year, nr, issueText, aStart, aEnd;
- var color;
- var imgTitle = '';
- var imgCategory = '';
- var imgDescription = '';
- var imgIssue = '';
- switch (sorting) {
- case 1:
- imgTitle = '<img src="images/arrows/arrowDown.gif" width="17" height="13" />';
- break;
- case 2:
- imgTitle = '<img src="images/arrows/arrowUp.gif" width="17" height="13" />';
- break;
- case 3:
- imgCategory = '<img src="images/arrows/arrowDown.gif" width="17" height="13" />';
- break;
- case 4:
- imgCategory = '<img src="images/arrows/arrowUp.gif" width="17" height="13" />';
- break;
- case 5:
- imgDescription = '<img src="images/arrows/arrowDown.gif" width="17" height="13" />';
- break;
- case 6:
- imgDescription = '<img src="images/arrows/arrowUp.gif" width="17" height="13" />';
- break;
- case 7:
- imgIssue = '<img src="images/arrows/arrowDown.gif" width="17" height="13" />';
- break;
- case 8:
- imgIssue = '<img src="images/arrows/arrowUp.gif" width="17" height="13" />';
- break;
- }
-
- doSort(resultItems);
-
- var result = '<div>';
-
- if( resultItems.length > 0 ) {
-
- result += '<table border="0" cellspacing="0" cellpadding="0" width="100%" class="searchResultsTableHeader">';
- result += '<tr id="searchHeader">';
-
- result += '<td id="firstSearchColumn" width="141"><div><a href="javascript: void(0);" style="padding-left: 5px;" onclick="setSorting(1, ' + type + ');">Titel</a></div><div class="sortImage">' + imgTitle + '</div></td>';
- result += '<td id="secondSearchColumn" width="525" class="borderLeft"><div><a href="javascript: void(0);" style="padding-left: 5px;" onclick="setSorting(5, ' + type + ');" class="searchCategory">Beschreibung</a></div><div class="sortImage">' + imgDescription + '</div></td>';
- result += '<td id="thirdSearchColumn" class="right"><div><a href="javascript: void(0);" style="padding-left: 1px;" onclick="setSorting(7, ' + type + ');" class="searchCategory">Ausgabe</a></div><div class="sortImage">' + imgIssue + '</div></td>';
-
- result += '</tr>';
- result += '</table>';
-
- result += '<div style="width: 100%; overflow: auto; background: white;" id="searchResultsDiv"><table cellpadding="0" cellspacing="0" border="0" class="searchResultsTable" id="searchResultsTable">';
-
- var onClickGoTo = "";
-
- for (var i=0; i<resultItems.length; i++) {
- resultItem = resultItems[i];
-
- if (parseInt(resultItem.year) == parseInt(actYear) && parseInt(resultItem.nr) == parseInt(actNo)) {
- issueText = resultItem.year + ' - ' + resultItem.nr;
- aStart = '<a href="javascript: void(0);" onclick="switch_iframe(\'' + resultItem.link + '\');">';
- aEnd = '</a>';
-
- onClickGoTo = "javascript:switch_iframe('" + resultItem.link + "');";
- }
- else {
- issueText = resultItem.year + ' - ' + resultItem.nr;
- aStart = '';
- aEnd = '';
- onClickGoTo = "javascript:switch_iframe('" + resultItem.link + "');";
- }
-
- if (i%2 == 0) {
- color = "One";
- }
- else {
- color = "Two";
- }
-
- result += '<tr valign="top" class="row' + color + '">';
-
- // result += '<td width="130">' + aStart + resultItem.title + aEnd + '</td>';
- if (sorting == 1 || sorting == 2) {
- result += '<td width="130" class="row' + color + 'Sort" onClick="' + onClickGoTo + '" onMouseOver="javascript:hightLightLine( this );" onMouseOut="javascript:unHightLightLine( this );">' + resultItem.title + '</td>';
- }
- else {
- result += '<td width="130" onClick="' + onClickGoTo + '" onMouseOver="javascript:hightLightLine( this );" onMouseOut="javascript:unHightLightLine( this );">' + resultItem.title + '</td>';
- }
-
- var tempTxt = ' ';
- if (resultItem.description.length > 0) {
- var tempTxt = resultItem.description;
- }
-
- if (sorting == 5 || sorting == 6) {
- result += '<td width="512" class="borderLeft row' + color + 'Sort" onClick="' + onClickGoTo + '" onMouseOver="javascript:hightLightLine( this );" onMouseOut="javascript:unHightLightLine( this );">' + tempTxt + '</td>';
- }
- else {
- result += '<td width="512" class="borderLeft" onClick="' + onClickGoTo + '" onMouseOver="javascript:hightLightLine( this );" onMouseOut="javascript:unHightLightLine( this );">' + tempTxt + '</td>';
- }
-
- if (sorting == 7 || sorting == 8) {
- result += '<td width="79" class="right row' + color + 'Sort" onClick="' + onClickGoTo + '" onMouseOver="javascript:hightLightLine( this );" onMouseOut="javascript:unHightLightLine( this );">' + issueText.replace(/ /g, "").replace(/-/g, "/") + '</td>';
- }
- else {
- result += '<td width="79" class="right" onClick="' + onClickGoTo + '" onMouseOver="javascript:hightLightLine( this );" onMouseOut="javascript:unHightLightLine( this );">' + issueText.replace(/ /g, "").replace(/-/g, "/") + '</td>';
- }
-
- result += '</tr>';
- }
-
- result += '</table>';
-
- } else {
- result += '<br /><br /><br /><h3 class="searchResults">Keine Elemente gefunden</h3>';
- }
-
- result += '</div>';
-
- return result;
- }
-
- /**
- * executeInnerHTMLJavaScript
- *
- * @param {Element} element
- */
- function executeInnerHTMLJavaScript( element ) {
-
- if( element != null ) {
-
- var scriptTags = element.getElementsByTagName( "script" );
-
- if( scriptTags != null && scriptTags.length > 0 ) {
-
- for( var loop = 0; loop < scriptTags.length; loop++ ) {
- eval( scriptTags[loop].text );
- }
- }
- }
- }
-
- function setAllTableCells(parentRow, className) {
- var cells = parentRow.getElementsByTagName('td');
- for (i=0; i<cells.length; i++) {
- switch (i) {
- case 0:
- globalHightLightColor1 = cells[0].className;
- break;
- case 1:
- globalHightLightColor2 = cells[1].className;
- break;
- case 2:
- globalHightLightColor3 = cells[2].className;
- break;
- }
-
- cells[i].className = className;
- }
- }
-
- function restorAllTableCells(parentRow) {
- var cells = parentRow.getElementsByTagName('td');
- for (i=0; i<cells.length; i++) {
- switch (i) {
- case 0:
- cells[0].className = globalHightLightColor1;
- break;
- case 1:
- cells[1].className = globalHightLightColor2;
- break;
- case 2:
- cells[2].className = globalHightLightColor3;
- break;
- }
- }
- }
-
- /**
- * hightLightLine
- *
- * @param {Node} element
- */
- function hightLightLine(element) {
- if( element != null ) {
- var parentElement = element.parentNode;
-
- if( parentElement != null ) {
- setAllTableCells(parentElement, 'rowSortActive');
- globalHightLightColor = parentElement.className;
- parentElement.className = "rowActive";
- }
- }
- }
-
- /**
- * unHightLightLine
- *
- * @param {Node} element
- */
- function unHightLightLine(element) {
- if( element != null ) {
- var parentElement = element.parentNode;
-
- if( parentElement != null ) {
- restorAllTableCells(parentElement);
- parentElement.className = globalHightLightColor;
- }
- }
- }
-
- /**
- * redrawResultsTable
- */
- function redrawResultsTable() {
-
- var element = document.getElementById( "searchResultsDiv" );
-
- if( element != null ) {
-
- var elementHeight = element.scrollHeight;
-
- var parentElement = element.parentNode;
-
- if( parentElement != null ) {
-
- var parentHeight = parentElement.scrollHeight;
-
- var firstElement = document.getElementById( "firstSearchColumn" );
- var secondElement = document.getElementById( "secondSearchColumn" );
- var thirdElement = document.getElementById( "thirdSearchColumn" );
-
- var tableElement = document.getElementById( "searchResultsTable" );
-
- //alert( "x: " + elementHeight + " - y: " + parentHeight );
-
- if( elementHeight >= parentHeight ) {
-
- // scrollbar present
-
- if( firstElement != null ) {
- firstElement.style.width = "140px";
- }
-
- if( secondElement != null ) {
- secondElement.style.width = "511px";
- }
-
- if( tableElement != null ) {
- tableElement.style.height = "";
- }
-
- } else {
-
- // no scrollbar
-
- if( firstElement != null ) {
- firstElement.style.width = "142px";
- }
-
- if( secondElement != null ) {
- secondElement.style.width = "524px";
- }
-
- if( tableElement != null ) {
- tableElement.style.height = "100%";
- }
-
- }
- }
- }
- }
-
- function closeSearchDivs() {
- switchLocalSearchDiv(false);
- switchGlobalSearchDiv(false);
-
- var searchesBox = document.getElementById( "searchesBox" );
- if( searchesBox != null ) {
- searchesBox.style.display = "block";
- }
- }
-
- function switchLocalSearchDiv(doShow) {
- var elementSearch = document.getElementById('localsearch');
- var elementIFrame = document.getElementById('iframe');
- if (elementSearch != null && elementIFrame != null) {
- if (doShow) {
- elementSearch.style.display = 'block';
- elementIFrame.style.display = 'none';
- }
- else {
- elementSearch.style.display = 'none';
- elementIFrame.style.display = 'block';
- }
- }
- }
-
- function switchGlobalSearchDiv(doShow) {
- var elementSearch = document.getElementById('globalsearch');
- var elementIFrame = document.getElementById('iframe');
- if (elementSearch != null && elementIFrame != null) {
- if (doShow) {
- elementSearch.style.display = 'block';
- elementIFrame.style.display = 'none';
- }
- else {
- elementSearch.style.display = 'none';
- elementIFrame.style.display = 'block';
- }
-
-
- var resultsElement = document.getElementById('globalsearchresult');
-
- if( resultsElement != null ) {
- resultsElement.style.display = "none";
- }
-
- }
-
- }
-
- function importXML(filename, type) {
- // 1 - local
- // 2 - global
- var xmlDoc = null;
- if (document.implementation && document.implementation.createDocument) {
- xmlDoc = document.implementation.createDocument("", "", null);
- }
- else if (window.ActiveXObject) {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- }
- else {
- alert('Your browser can\'t handle this script');
- return;
- }
- xmlDoc.load(filename);
- xmlDoc.setProperty("SelectionLanguage", "XPath");
-
- if (type == 1) {
- xmlDocLocal = xmlDoc;
- }
- else {
- xmlDocGlobal = xmlDoc;
- }
-
- }
-
- function doLocalSearch() {
- var res = '';
-
- var searchText = "";
- var element = document.getElementById('searchinput');
- if (element != null) {
- searchText = element.value;
- searchText = searchText.toLowerCase();
- }
- if (searchText != "") {
- switchLocalSearchDiv(true);
- switchGlobalSearchDiv(false);
-
- if (xmlDocLocal == null) {
- importXML('localsearch.xml', 1);
- }
-
- var xpath = "//t[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')] | //k[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')] | //l[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')] | //la[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')] | //os[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')] | //f[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')] ";
-
- var resultNodes = xmlDocLocal.selectNodes(xpath);
- localResultNodes = getResultArray(resultNodes);
- var html = getResultHTML(localResultNodes, 1);
- var searchContent = document.getElementById('searchContentLocal');
-
- if (searchContent != null) {
- searchContent.innerHTML = html;
- resizeIFrame();
- redrawResultsTable();
- //executeInnerHTMLJavaScript( searchContent );
- }
-
- switchLocalSearchDiv(true);
- }
- }
-
- function getLanguageString() {
- var res = '';
- var langElement;
-
- langElement = document.getElementById('searchInLangDE');
- if (langElement != null && langElement.checked) {
- res += "./parent::*/la[contains(., 'deutsch')] and ";
- }
- langElement = document.getElementById('searchInLangEN');
- if (langElement != null && langElement.checked) {
- res += "./parent::*/la[contains(., 'englisch')] and ";
- }
- langElement = document.getElementById('searchInLangFR');
- if (langElement != null && langElement.checked) {
- res += "./parent::*/la[contains(., 'franz├╢sisch')] and ";
- }
- langElement = document.getElementById('searchInLangES');
- if (langElement != null && langElement.checked) {
- res += "./parent::*/la[contains(., 'spanisch')] and ";
- }
- langElement = document.getElementById('searchInLangIT');
- if (langElement != null && langElement.checked) {
- res += "./parent::*/la[contains(., 'italienisch')] and ";
- }
-
- res = res.substr(0, res.length-4);
-
- if (res != '') {
- res = "((" + res + ") or ./parent::*/la[contains(., 'multilingual')])";
- }
- return res;
- }
-
- function getOSString() {
- var res = '';
- var osElement;
-
- osElement = document.getElementById('searchInOS95');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows 95')] and ";
- }
- osElement = document.getElementById('searchInOS98');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows 98')] and ";
- }
- osElement = document.getElementById('searchInOSMe');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows Me')] and ";
- }
- osElement = document.getElementById('searchInOS2000');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows 2000')] and ";
- }
- osElement = document.getElementById('searchInOS2003');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows 2003')] and ";
- }
- osElement = document.getElementById('searchInOSXP');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows XP')] and ";
- }
- osElement = document.getElementById('searchInOSXP64');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows XP 64')] and ";
- }
- osElement = document.getElementById('searchInOSVista');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows Vista')] and ";
- }
- osElement = document.getElementById('searchInOSVista64');
- if (osElement != null && osElement.checked) {
- res += "./parent::*/os[contains(., 'Windows Vista 64')] and ";
- }
-
- res = res.substr(0, res.length-4);
-
- if (res != '') {
- res = "(" + res + ")";
- }
- return res;
- }
-
- function getGlobalXPathString(searchText) {
- var categoryString = '';
- var res = '';
-
- searchText = searchText.toLowerCase();
-
- // Kategorien
- var catElement = document.getElementById('categoryAll');
- if (catElement != null && !catElement.checked) {
- for (var i=0; i<availableCategories.length; i++) {
- catElement = document.getElementById('category' + i);
- if (catElement != null && catElement.checked) {
- categoryString += "./parent::*[@c='" + availableCategories[i] + "'] or ";
- }
- }
- if (categoryString != '') {
- categoryString = categoryString.substr(0, categoryString.length-3);
- categoryString = "(" + categoryString + ")";
- }
- }
-
- // Sprachen
- var languageString = getLanguageString();
-
- // Betriebsysteme
- var osString = getOSString();
-
- // alert(languageString);
-
- // Ausgaben
- var issueString = '';
- for (var i=0; i<availableIssues.length; i++) {
- var issue = availableIssues[i];
- var year = issue.year;
- var nos = issue.nos;
- var issueElement = document.getElementById('issueyear' + year);
- if (issueElement != null) {
- if (issueElement.checked) {
- // ganzes Jahr
- issueString += "./parent::*/parent::*[@year='" + year + "'] or ";
- }
- else {
- for (var j=0; j<nos.length; j++) {
- var nr = nos[j];
- var issueSubElement = document.getElementById('issueno' + nr + year);
- if (issueSubElement != null && issueSubElement.checked) {
- issueString += "./parent::*/parent::*[@year='" + year + "' and @nr='" + nr + "'] or ";
- }
- }
- }
- }
- }
- if (issueString != '') {
- issueString = issueString.substr(0, issueString.length-3); // -3 damit " or" gefilter wird
- issueString = "(" + issueString + ")";
- }
-
- // im Titel immer suchen
- res += "//t[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')";
- if (categoryString != '') {
- res += " and " + categoryString;
- }
- if (issueString != '') {
- res += " and " + issueString;
- }
- if (languageString != '') {
- res += " and " + languageString;
- }
- if (osString != '') {
- res += " and " + osString;
- }
-
- res += '] | ';
-
- if (document.getElementById('searchInShort').checked) {
- res += "//k[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')";
- if (categoryString != '') {
- res += " and " + categoryString;
- }
- if (issueString != '') {
- res += " and " + issueString;
- }
- if (languageString != '') {
- res += " and " + languageString;
- }
- if (osString != '') {
- res += " and " + osString;
- }
- res += '] | ';
- }
-
- if (document.getElementById('searchInLong').checked) {
- res += "//l[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')";
- if (categoryString != '') {
- res += " and " + categoryString;
- }
- if (issueString != '') {
- res += " and " + issueString;
- }
- if (languageString != '') {
- res += " and " + languageString;
- }
- if (osString != '') {
- res += " and " + osString;
- }
- res += '] | ';
- }
-
- if (document.getElementById('searchInFiles').checked) {
- res += "//f[contains(translate(., '" + bigLetters + "','" + smallLetters + "'),'" + searchText + "')";
- if (categoryString != '') {
- res += " and " + categoryString;
- }
- if (issueString != '') {
- res += " and " + issueString;
- }
- if (languageString != '') {
- res += " and " + languageString;
- }
- if (osString != '') {
- res += " and " + osString;
- }
- res += '] | ';
- }
-
- res = res.substr(0, res.length-2);
-
- return res;
- }
-
- function searchGlobal_nohistory() {
- var searchText = "";
- var element = document.getElementById('searchglobalinput');
- if (element != null) {
- searchText = element.value;
- }
-
- if (searchText != "") {
- var xpath = getGlobalXPathString(searchText);
- var resultNodes = xmlDocGlobal.selectNodes(xpath);
- globalResultNodes = getResultArray(resultNodes);
- var html = getResultHTML(globalResultNodes, 2);
- var searchContent = document.getElementById('searchContentGlobal');
- if (searchContent != null) {
- searchContent.innerHTML = html;
- }
-
- var resultsElement = document.getElementById('globalsearchresult');
-
- if( resultsElement != null ) {
- resultsElement.style.display = "inline";
- }
-
- toggleTab_nohistory(2);
-
- if (searchContent != null) {
- resizeIFrame();
- redrawResultsTable();
- }
-
- }
- }
-
- function searchGlobal() {
- var searchText = "";
- var element = document.getElementById('searchglobalinput');
- if (element != null) {
- searchText = element.value;
- }
-
- if (searchText != "") {
- var xpath = getGlobalXPathString(searchText);
- var resultNodes = xmlDocGlobal.selectNodes(xpath);
- globalResultNodes = getResultArray(resultNodes);
- var html = getResultHTML(globalResultNodes, 2);
- var searchContent = document.getElementById('searchContentGlobal');
- if (searchContent != null) {
- searchContent.innerHTML = html;
- }
-
- var resultsElement = document.getElementById('globalsearchresult');
-
- if( resultsElement != null ) {
- resultsElement.style.display = "inline";
- }
-
- toggleTab(2);
-
- if (searchContent != null) {
- resizeIFrame();
- redrawResultsTable();
- }
-
- }
- }
-
- function showDiv(value, divName) {
- var element = document.getElementById(divName);
- if (element != null) {
- if (value) {
- element.style.display = 'block';
- }
- else {
- element.style.display = 'none';
- }
- }
- }
-
- function showPlaeseWait(value) {
- showDiv(value, 'pleaseWait');
- }
-
- function showCategoriesDiv(value) {
- showDiv(value, 'searchCategories');
- }
-
- function showIssuesDiv(value) {
- showDiv(value, 'searchIssues');
- }
-
- function insertCategoryIntoArray(category) {
- var boolFound = false;
- for (var i=0; i<availableCategories.length; i++) {
- if (availableCategories[i] == category) {
- boolFound = true;
- break;
- }
- }
-
- if (!boolFound) {
- availableCategories.push(category);
- }
- }
-
- function loadCategories() {
- availableCategories = new Array();
- var category;
- var softwareNodes = xmlDocGlobal.getElementsByTagName('s');
- for (var i=0; i<softwareNodes.length; i++) {
- var softwareNode = softwareNodes[i];
- category = softwareNode.getAttribute('l');
-
- if( category != null && category != "null" ) {
- insertCategoryIntoArray(category);
- }
- }
- availableCategories.sort();
- }
-
- function insertIssueIntoArray(issueYear, issueNo) {
- var boolFoundYear = false;
- var boolFoundNo = false;
- for (var i=0; i<availableIssues.length; i++) {
- if (availableIssues[i].year == issueYear) {
- boolFoundYear = true;
- for (var j=0; j<availableIssues[i].nos.length; j++) {
- if (availableIssues[i].nos[j] == issueNo) {
- boolFoundNo = true;
- break;
- }
- }
- break;
- }
- }
-
- if (!boolFoundYear) {
- var item = new issueItem();
- item.year = issueYear;
- if (item.nos == null) {
- item.nos = new Array();
- }
- item.nos.push(issueNo);
- availableIssues.push(item);
- }
- else {
- if (!boolFoundNo) {
- var item = availableIssues[i];
- item.nos.push(issueNo);
- }
- }
- }
-
- function toggleYear(year) {
- var element = document.getElementById('year' + year);
- var elementImage = document.getElementById('plusminus' + year);
- if (element != null) {
- if (element.style.display == 'block') {
- element.style.display = 'none';
- elementImage.src = 'images/tree_plus.gif';
- }
- else {
- element.style.display = 'block';
- elementImage.src = 'images/tree_minus.gif';
- }
- }
- }
-
- function loadIssues() {
- availableIssues = new Array();
- var issueYear;
- var issueNo;
- var issueNodes = xmlDocGlobal.getElementsByTagName('i');
- for (var i=0; i<issueNodes.length; i++) {
- var issueNode = issueNodes[i];
- issueYear = issueNode.getAttribute('year');
- issueNo = issueNode.getAttribute('nr');
- insertIssueIntoArray(issueYear, issueNo);
- }
- availableCategories.sort();
- }
-
- function uncheckFirstAllCategory(element) {
- if (element.checked) {
- var catAll = document.getElementById('categoryAll');
- if (catAll != null) {
- catAll.checked = false;
- }
- }
- }
-
- function uncheckCategories(element) {
- if (element.checked) {
- for (var i=0; i<availableCategories.length; i++) {
- var cat = document.getElementById('category' + i);
- if (cat != null) {
- cat.checked = false;
- }
- }
- }
- }
-
- function setCategoriesHTML() {
- var element = document.getElementById('searchCategories');
- if (element != null) {
- var result = '<strong>Lizenzart auswählen</strong><br /><br />';
- result += '<input type="checkbox" id="categoryAll" onclick="uncheckCategories(this);" checked/>Alle<br>';
- for (var i=0; i<availableCategories.length; i++) {
- if (availableCategories[i] != '') {
- result += '<input type="checkbox" id="category' + i + '" onclick="uncheckFirstAllCategory(this);" />' + availableCategories[i] + '<br />';
- }
- }
- element.innerHTML = result;
- }
- }
-
- function selectWholeYear(element) {
- if (element.checked) {
- var id = element.id;
- id = id.substr(9);
- for (var i=0; i<availableIssues.length; i++) {
- var issue = availableIssues[i];
- var year = issue.year;
- var nos = issue.nos;
- if (year == id) {
- for (var j=0; j<nos.length; j++) {
- var tmp = document.getElementById('issueno' + nos[j] + year);
- tmp.checked = true;
- }
- }
- }
- }
- }
-
- function deselectYear(element, year) {
- if (!element.checked) {
- var tmp = document.getElementById('issueyear' + year);
- if (tmp != null) {
- tmp.checked = false;
- }
- }
- }
-
- function setIssuesHTML() {
- var issueNoChecked = '';
- var element = document.getElementById('searchIssues');
- if (element != null) {
- var result = '<strong>Ausgaben auswählen</strong><br /><br />';
- for (var i=0; i<availableIssues.length; i++) {
- var issue = availableIssues[i];
- var year = issue.year;
- var nos = issue.nos;
- var srcLevel1 = 'images/tree_vert_hor.gif';
- var srcLevel1Next = 'images/tree_vert.gif';
- if (i == (availableIssues.length-1)) {
- srcLevel1 = 'images/tree_vert_hor_end.gif';
- srcLevel1Next = 'images/blank.gif';
- }
-
- result += '<div class="treeview"><img src="' + srcLevel1 + '" /><a href="javascript: void(0);" onclick="toggleYear(\'' + issue.year + '\');"><img src="images/tree_minus.gif" id="plusminus' + issue.year + '" /></a>';
- result += '<div class="treeContainer"><input class="treeinput" type="checkbox" id="issueyear' + issue.year + '" onclick="selectWholeYear(this);" /><span class="treeline"> ' + year + '</span></div><div class="clearDiv"></div>';
- result += '<div id="year' + issue.year+ '" style="display: block;">';
- for (var j=0; j<nos.length; j++) {
- var srcLevel2 = 'images/tree_vert_hor.gif';
- if (j == (nos.length-1)) {
- srcLevel2 = 'images/tree_vert_hor_end.gif';
- }
- debug(year + '-' + actYear);
- debug(nos[j] + '-' + actNo);
- if (parseInt(year) == parseInt(actYear) && parseInt(nos[j]) == parseInt(actNo)) {
- issueNoChecked = 'CHECKED';
- }
- result += '<div class="treeview"><img src="' + srcLevel1Next + '"><img src="' + srcLevel2 + '"><input class="treeinput" type="checkbox" id="issueno' + nos[j] + year + '" onclick="deselectYear(this, \'' + year + '\');" ' + issueNoChecked + '/><span class="treeline"> ' + nos[j] + '</span></div><div class="clearDiv"></div>';
- }
- result += '</div>';
- }
-
- element.innerHTML = result;
- }
- }
-
- function doGlobalSearch_nohistory() {
- var element = document.getElementById('searchglobalinput');
-
- var searchesBox = document.getElementById( "searchesBox" );
-
- if( searchesBox != null ) {
- searchesBox.style.display = "none";
- }
-
- if (element != null) {
- element.value = '';
- }
-
- toggleTab_nohistory(1);
-
- var tabResult = document.getElementById('searchContentGlobal');
- tabResult.innerHTML = '';
-
- switchLocalSearchDiv(false);
- switchGlobalSearchDiv(true);
- if (xmlDocGlobal == null) {
- showPlaeseWait(true);
- importXML('globalsearch.xml', 2);
- loadCategories();
- loadIssues();
- showPlaeseWait(false);
- if (availableCategories.length > 0) {
- setCategoriesHTML();
- showCategoriesDiv(true);
- }
- else {
- showCategoriesDiv(false);
- }
- if (availableIssues.length > 0) {
- setIssuesHTML();
- showIssuesDiv(true);
- }
- else {
- showIssuesDiv(false);
- }
- }
- }
-
- function doGlobalSearch() {
- var element = document.getElementById('searchglobalinput');
-
- var searchesBox = document.getElementById( "searchesBox" );
-
- if( searchesBox != null ) {
- searchesBox.style.display = "none";
- }
-
- if (element != null) {
- element.value = '';
- }
-
- toggleTab(1);
-
- var tabResult = document.getElementById('searchContentGlobal');
- tabResult.innerHTML = '';
-
- switchLocalSearchDiv(false);
- switchGlobalSearchDiv(true);
- if (xmlDocGlobal == null) {
- showPlaeseWait(true);
- importXML('globalsearch.xml', 2);
- loadCategories();
- loadIssues();
- showPlaeseWait(false);
- if (availableCategories.length > 0) {
- setCategoriesHTML();
- showCategoriesDiv(true);
- }
- else {
- showCategoriesDiv(false);
- }
- if (availableIssues.length > 0) {
- setIssuesHTML();
- showIssuesDiv(true);
- }
- else {
- showIssuesDiv(false);
- }
- }
- }
-